# -*- Mode: Makefile -*- 

### This makefile produces an executable for each name in the `ebase'
###  variable using the libraries named in the `LibNames' variable.

# included makefiles need an absolute path
CHOMBO_HOME := $(HOME)/Chombo/lib

makefiles+=lib_test_amrelliptic

LAPACKLIBS = -lblas -llapack -lcppunit -llapacke

ebase := TestYinFab1 TestYinFab2

LibNames := AMRElliptic AMRTools BoxTools

base_dir = .
src_dirs += ../src/Core ../src/YinSet ./Test

include $(CHOMBO_HOME)/mk/Make.example

LIBFLAGS += $(LAPACKLIBS)

RunYinFabTest:
	make TestYinFab1 NAMESPACE=TRUE
	make TestYinFab2 NAMESPACE=TRUE
	make cleanDat	
	./TestYinFab12d_ch.Linux.64.g++.gfortran.DEBUG.ex > TestYinFab1.txt
	./TestYinFab22d_ch.Linux.64.g++.gfortran.DEBUG.ex > TestYinFab2.txt
	cd dataTestYinFab1 && find . -name "*" -type f -size 0c | xargs -n 1 rm -f
	cd dataTestYinFab2 && find . -name "*" -type f -size 0c | xargs -n 1 rm -f
	@echo YinFab Tests have been generated.

plotting:
	cd matlab && matlab -nodesktop -nosplash -noFigureWindows < carry.m
	@echo plotYin1,2.png has been generated.

doc:
	xelatex report.tex
	xelatex report.tex

cleaner:
	-rm *.aux
	-rm *.log
	-rm *.png
	-rm *.pdf
	-rm TestYinFab1.txt
	-rm TestYinFab2.txt
	make cleanDat
	make clean NAMESPACE=TRUE

cleanDat:
	-rm dataTestYinFab1/*.dat
	-rm dataTestYinFab2/*.dat
